#!/bin/bash
topName=$1
date=$(date +%y%m%d)

adone="/projects.SE024/cascade/workspace/xjsun/${topName}/post.${date}/dataout/steam.done"

while [ "1" == "1" ]; do

if [ -e ${adone} ]; then
    echo "Exist!!"
    bash /projects.SE024/cascade/workspace/xjsun/PV/v2lvs/run_v2lvs.sh ${topName}

    if [ -e "/projects.SE024/cascade/workspace/xjsun/PV/v2lvs/${topName}.spi" ]; then
        echo "Exist Netlist!!"
        bash /projects.SE024/cascade/workspace/xjsun/PV/LVS/run_lvs.sh ${topName}
        
        rm -f ${adone}

        break
    else
        echo "Not exist Netlist!!"
    fi
else
    echo "Not exist done file, sleep 60s!!"
    sleep 60

fi

done